package com.camel.weixin.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.camel.core.config.RequestEnumJsonDeserialize;
import com.camel.core.entity.BasePaginationEntity;
import com.camel.core.enumhandler.MyIntegerToEnumHandler;
import com.camel.core.enums.YesNo;
import com.camel.weixin.enums.WxAccountType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 微信公众号
 *
 * @author Administrator
 * @TableName wx_account
 */
@TableName(value = "wx_account")
@Data
public class WxAccount extends BasePaginationEntity implements Serializable {

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 公众号名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 原始ID
     */
    @TableField(value = "origin_id")
    private String originId;

    /**
     * appid
     */
    @TableField(value = "appid")
    private String appid;

    /**
     * 公众号类型
     */
    @TableField(value = "atype", typeHandler = MyIntegerToEnumHandler.class)
    @JsonDeserialize(using = RequestEnumJsonDeserialize.class)
    private WxAccountType atype;

    /**
     * 是否认证
     */
    @TableField(value = "authentication", typeHandler = MyIntegerToEnumHandler.class)
    @JsonDeserialize(using = RequestEnumJsonDeserialize.class)
    private YesNo authentication;

    /**
     * 微信号
     */
    @TableField(value = "wx_account")
    private String wxAccount;

    /**
     * AppSecret
     */
    @TableField(value = "app_secret")
    private String appSecret;

    /**
     * Access token
     */
    @TableField(value = "access_token")
    private String accessToken;

    /**
     * token获取时间
     */
    @TableField(value = "token_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date tokenTime;
}